package ru.jexp.rcp.supply.editor.actionbar;

import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.part.EditorActionBarContributor;

import ru.jexp.rcp.supply.beans.d18.D18ActionOpen;
import ru.jexp.rcp.supply.editor.EditorPartProject;

public class EditorPartProjectBarContributor extends EditorActionBarContributor
{
	private D18ActionOpen actionOpenD18;

	@Override
	public void contributeToToolBar(IToolBarManager toolBarManager)
	{
		toolBarManager.add(actionOpenD18);
	}

	@Override
	public void setActiveEditor(IEditorPart editor)
	{
		if (editor instanceof EditorPartProject)
		{
			actionOpenD18.setEditor((EditorPartProject) editor);
		}
	}
	
	@Override
	public void init(IActionBars bars, IWorkbenchPage page)
	{
		actionOpenD18 = new D18ActionOpen(page.getWorkbenchWindow());
		super.init(bars, page);
	}
}
